﻿using Appliaction.Dto.FG;
using Appliaction.IAppServices.FG;
using Domain.Entitys.FG;
using Domain.Entitys.Inv;
using EFCore.Repositorys.FG;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace API.Controllers.FG
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class FG_Picking_OutboundController : ControllerBase
    {
        private readonly IFG_Picking_OutboundService fG_Picking_OutboundService;

        public FG_Picking_OutboundController(IFG_Picking_OutboundService fG_Picking_OutboundService)
        {
            this.fG_Picking_OutboundService = fG_Picking_OutboundService;
        }

        /// <summary>
        /// 条件查询总条数
        /// </summary>
        /// <param name="Picking_outbound_code"></param>
        /// <param name="Warehouse_code"></param>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetFG_Picking_OutboundCount(string? Picking_outbound_code, string? Warehouse_code)
        {
            return new JsonResult(fG_Picking_OutboundService.GetFG_Picking_OutboundCount(Picking_outbound_code, Warehouse_code));
        }

        /// <summary>
        /// 分页条件查询信息
        /// </summary>
        /// <param name="Picking_outbound_code"></param>
        /// <param name="Warehouse_code"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetFG_Picking_OutboundFYwhere(string? Picking_outbound_code, string? Warehouse_code, int currentPage, int pageSize)
        {
            return new JsonResult(fG_Picking_OutboundService.GetFG_Picking_OutboundFYwhere(Picking_outbound_code, Warehouse_code, currentPage, pageSize));
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="fG_Picking_Outbound_DeleteDto"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IActionResult> PutFG_Picking_OutboundDelete(FG_Picking_Outbound_DeleteDto fG_Picking_Outbound_DeleteDto)
        {
            var data = await fG_Picking_OutboundService.PutFG_Picking_OutboundDelete(fG_Picking_Outbound_DeleteDto);
            return Ok(data);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="fg_Picking_Outbound_OrderAdd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<JsonResult> PutFG_Picking_OutboundAdd([FromBody] Fg_Picking_Outbound_OrderAddDto<FG_Picking_Outbound_AddDto> fg_Picking_Outbound_OrderAdd)
        {
            return new JsonResult(await fG_Picking_OutboundService.PutFG_Picking_OutboundAdd(fg_Picking_Outbound_OrderAdd));
        }
        /// <summary>
        /// 查询库存信息
        /// </summary>
        /// <param name="Warehouse_Code"></param>
        /// <param name="Zone_Code"></param>
        /// <param name="pro_code"></param>
        /// <param name="pro_attribute_id"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetInv_StockAsyncs(string? Warehouse_Code, string? Zone_Code, string? pro_code, int pro_attribute_id, int currentPage, int pageSize)
        {
            var data = await fG_Picking_OutboundService.GetInv_StockAsyncs(Warehouse_Code, Zone_Code, pro_code, pro_attribute_id, currentPage, pageSize);
            return Ok(data);
        }
        /// <summary>
        /// 查询库存总条数
        /// </summary>
        /// <param name="Warehouse_Code"></param>
        /// <param name="Zone_Code"></param>
        /// <param name="pro_code"></param>
        /// <param name="pro_attribute_id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Inv_StockCountAsyncs(string? Warehouse_Code, string? Zone_Code, string? pro_code, int pro_attribute_id)
        {
            var data = await fG_Picking_OutboundService.Inv_StockCountAsyncs(Warehouse_Code, Zone_Code, pro_code, pro_attribute_id);
            return Ok(data);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="fg_Picking_Outbound_OrderUpdateDto"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<JsonResult> PutFg_Picking_OutboundUpdate([FromBody] Fg_Picking_Outbound_OrderUpdateDto<FG_Picking_Outbound_UpdateDto> fg_Picking_Outbound_OrderUpdateDto)
        {
            return new JsonResult(await fG_Picking_OutboundService.PutFg_Picking_OutboundUpdate(fg_Picking_Outbound_OrderUpdateDto));
        }
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="fg_Picking_Outbound_OrderAuditDto"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<JsonResult> PutFg_Picking_OutboundAudit([FromBody] Fg_Picking_Outbound_OrderAuditDto<FG_Picking_Outbound_AuditDto> fg_Picking_Outbound_OrderAuditDto)
        {
            return new JsonResult(await fG_Picking_OutboundService.PutFg_Picking_OutboundAudit(fg_Picking_Outbound_OrderAuditDto));
        }
    }
}
